from django.contrib import admin
from hosting.domains.models import RR, SOA

def deactivate(modeladmin, request, queryset):
    queryset.update(active=False)
deactivate.short_description = "Deactivate"

def activate(modeladmin, request, queryset):
    queryset.update(active=True)
activate.short_description = "Activate"

class RRInline(admin.TabularInline):
    extra = 1
    model = RR

class SOAAdmin(admin.ModelAdmin):
    list_display = ('origin','active','user',)
    list_filter = ('active','user',)
    order = ('host')
    actions = [deactivate, activate]
    inlines = [
        RRInline,
    ]
admin.site.register(SOA, SOAAdmin)
